using UnityEngine;

public class SnailPatrolState : BaseState
{

  public override void OnEnter(Enemy enemy)
  {
    curEnemy = enemy;
    curEnemy.curSpeed = curEnemy.normalSpeed;
  }

  public override void LogicUpdate()
  {
    //TODO：一旦发现敌人 切换到技能状态 蜗牛的技能就是缩壳里
    if (curEnemy.FoundPlayer())
    {
      curEnemy.SwitchState(NPCState.Skill);
    }

    if (!curEnemy.physicCheck.isGround || curEnemy.physicCheck.touchHeadWall)
    {
      curEnemy.isWait = true;
      curEnemy.anim.SetBool("walk", false);
    }
    else
    {
      curEnemy.anim.SetBool("walk", true);
    }
  }

  public override void PhysicsUpdate()
  {
  }

  public override void OnExit()
  {
    curEnemy.anim.SetBool("walk", false);
  }
}
